/*
 *         (C) COPYRIGHT Ingenic Limited
 *              ALL RIGHT RESERVED
 *
 * File        : uranus_common_type.h
 * Authors     : lzwang
 * Create Time : 2021-10-14 18:14:03 (CST)
 * Description :
 *
 */

#ifndef __MAGIK_URANUS_COMMON_COMMON_TYPE_H__
#define __MAGIK_URANUS_COMMON_COMMON_TYPE_H__
#include "uranus_common_def.h"

namespace magik {
namespace uranus {

enum class ChannelLayout : int URANUS_API {
    NONE = -1,
    NV12 = 0,
    BGRA = 1,
    RGBA = 2,
    ARGB = 3,
    RGB = 4,
    GRAY = 5,
    FP = 6
};

enum class TransformType : int URANUS_API {
    NONE = -1,
    NV12_NV12 = 0,
};

enum class DataType : int URANUS_API {
    NONE = -1, /*is not supported*/
    FP32 = 0,
    UINT32 = 1,
    INT32 = 2,
    UINT16 = 3,
    INT16 = 4,
    UINT14 = 5,
    INT14 = 6,
    UINT12 = 7,
    INT12 = 8,
    UINT10 = 9,
    INT10 = 10,
    UINT8 = 11,
    INT8 = 12,
    UINT6B = 13,
    UINT4B = 14,
    UINT2B = 15,
    BOOL = 16,
};

enum class DataFormat : int URANUS_API {
    NONE = -1,
    /*
     * 1. image format.
     * (1). BGR0, eg: shape=[1, 3, 6, 4]:
     * +------------------------+
     * |BGR0BGR0BGR0BGR0BGR0BGR0|
     * |BGR0BGR0BGR0BGR0BGR0BGR0|
     * |BGR0BGR0BGR0BGR0BGR0BGR0|
     * +------------------------+
     * (2). RGB0, eg: shape=[1, 3, 6, 4]:
     * +------------------------+
     * |RGB0RGB0RGB0RGB0RGB0RGB0|
     * |RGB0RGB0RGB0RGB0RGB0RGB0|
     * |RGB0BGR0BGR0RGB0RGB0RGB0|
     * +------------------------+
     * (3). GRAY, eg: shape=[1, 3, 24, 1]:
     * +------------------------+
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * +------------------------+
     * 2.Feature layout
     * [N_BATCH, HEIGHT, WIDTH, CHN]
     */
    NHWC = 0,
    /*
     * Feature layout, eg fp, coord
     * [N_BATCH, D_C32, HEIGHT, WIDTH, CHN_32]
     */
    NDHWC32 = 1,
    /*
     * Weight layout
     * [KERNEL_H, KERNEL_W, I_CHN, O_CHN]
     */
    HWIO = 2,
    /*
     * Weight layout, eg weight
     * [N_OFP, M_IFP, KERNEL_H, KERNEL_W, S_BIT2, OFP, IFP]
     */
    NMHWSOIB2 = 3,
    /*
     *Weight layout, eg bt
     *[N_OFP, M_BT, CHN_32]
     */
    NMC32 = 4,
    /*
     *Weight layout, eg scale/lut
     *[d1]
     */
    D1 = 5,
    /*
     * image format for nv12.
     * eg: shape=[1, 4, 24, 1]:
     * +------------------------+
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * |YYYYYYYYYYYYYYYYYYYYYYYY|
     * +------------------------+
     * |UVUVUVUVUVUVUVUVUVUVUVUV|
     * |UVUVUVUVUVUVUVUVUVUVUVUV|
     * +------------------------+
     */
    NV12 = 6,
    /*
     * Weight layout
     * [O_CHN, KERNEL_H, KERNEL_W, I_CHN]
     */
    OHWI = 7,
    /*
     * Feature layout
     * [N_BATCH, CHN, HEIGHT, WIDTH]
     */
    NCHW = 8,
    /*
     * Feature layout
     * [N_BATCH, CHN]
     */
    NC = 9,
    /*
     * Feature layout
     * [N_BATCH, WIDTH, CHN]
     */
    NWC = 10,
    /*
     * [N_BATCH, HEIGHT, WIDTH, CHN1, CHN2]
     */
    NHWC1C2 = 11,
    /*
     * [N_BATCH, HEIGHT, WIDTH, CHN1, CHN2, CHN3]
     */
    NHWC1C2C3 = 12,
    /*
     * [N_BATCH, HEIGHT, WIDTH, CHN1, CHN2, CHN3, CHN4]
     */
    NHWC1C2C3C4 = 13,
    /*
     * Feature layout, eg fp, coord
     * [N_BATCH, HEIGHT, D_C32, WIDTH, CHN_32]
     */
    NHDWC32 = 14,
    /*
     * Feature layout, eg fp, coord
     * [N_BATCH, HEIGHT, D_C8, WIDTH, CHN_8]
     */
    NHDWC8 = 15,
};

enum class Device : int URANUS_API {
    /*Unsupported*/
    NONE = -1,
    /*nmem, alloc memory by mudata*/
    CPU = 1,
    /*RAM of NPU, alloc memory by mudata, users disabled*/
    AIE = 2,
    /*external DDR memory(nmem, rmem, ...), must be contiguous memory block and aligned with 64
       bytes*/
    EXT_CPU = 3,
    /*external NPU RAM, must be contiguous memory block and aligned with 64 bytes*/
    EXT_AIE = 4,
};

struct URANUS_API ConvParam {
    int kernel_w = 1;
    int kernel_h = 1;
    int stride_w = 1;
    int stride_h = 1;
    int pad_top = 0;
    int pad_bottom = 0;
    int pad_left = 0;
    int pad_right = 0;
    int dialation_w = 1;
    int dialation_h = 1;
};

} // namespace uranus
} // namespace magik
#endif /* __MAGIK_URANUS_COMMON_COMMON_TYPE_H__ */
